package com.penjin.android.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.CheckBox;

import com.penjin.android.R;
import com.penjin.android.domain.KaoqinDepartment;

import java.util.List;

/**
 * Created by fengjw on 2016/3/25.
 */
public class KaoqinPopwindowAdapter extends BaseAdapter{
    private LayoutInflater mInflater;
    private Context mContext;

    private List<KaoqinDepartment> data;

    public String[] str={"所有部门","行政部","业务部","生产部","品管部","技术部","开发部"};

    public KaoqinPopwindowAdapter(Context context, List<KaoqinDepartment> data){
        mContext = context;
        mInflater = LayoutInflater.from(context);
        this.data=data;
    }

    @Override
    public int getCount() {
        return data.size();
    }

    @Override
    public Object getItem(int i) {
        return data.get(i);
    }

    @Override
    public long getItemId(int i) {
        return i;
    }

    @Override
    public View getView(int i, View convertView, ViewGroup viewGroup) {

        if(convertView == null){
            convertView=mInflater.inflate(R.layout.item_kaoqin_popwindow,null);

            KaoqinDepartment kaoqinDepartment=data.get(i);

            CheckBox checkBox=(CheckBox) convertView.findViewById(R.id.check_popwindow);
            checkBox.setText(kaoqinDepartment.getDepartment());

        }


        return convertView;
    }

}
